<?php
/**
 * 留言报名
 */
namespace Member\Controller;
use Org\Yike\Member;
class MessageController extends CommonController {
    public function _initialize(){
        parent::_initialize();
        $this->is_login();
    }

    //团购报名
    public function group(){
        $member = new Member();
        $list = $member::getGroupMess(20,array('oh.type'=>4,'oh.user_id'=>$this->user['id']),true);
        $this->list = $list;
        $this->seoKey(array('seo_title'=>'团购报名'));
        $this->display();
    }

    //团购详细
    public function groupDetail(){
        $id = intval($_GET['id']);
        $order = M('order_house')->where(array('id'=>$id,'type'=>4,'user_id'=>$this->user['id']))->find();
        if(!$order['id']){
            $this->error('找不到对应的团购信息');
        }
        $this->group = M('group')->where(array('id'=>$order['group_id']))->field('title,house_id')->find();
        $this->house = M('house')->where(array('id'=>$this->group['house_id']))->field('title')->find();
        $this->order = $order;
        $this->seoKey(array('seo_title'=>'团购报名详细'));
        $this->display();
    }

    //新房留言
    public function house(){
        $member = new Member();
        $list = $member::getHouseMess(20,array('oh.user_id'=>$this->user['id']),true);
        $this->type = order_type('house');
        $this->list = $list;
        $this->seoKey(array('seo_title'=>'新房留言'));
        $this->display();
    }

    //新房留言
    public function houseDetail(){
        $id = intval($_GET['id']);
        $order = M('order_house')->where(array('id'=>$id,'user_id'=>$this->user['id']))->find();
        if(!$order['id']){
            $this->error('找不到对应的新房信息');
        }
        $this->house = M('house')->where(array('id'=>$order['house_id']))->field('title')->find();
        $this->order = $order;
        $this->seoKey(array('seo_title'=>'新房留言详细'));
        $this->display();
    }

    //二手房留言
    public function used(){
        $member = new Member();
        $list = $member::getUsedMess(20,array('ou.user_id'=>$this->user['id']),true);
        $this->type = order_type('used');
        $this->list = $list;
        $this->seoKey(array('seo_title'=>'二手房'));
        $this->display();
    }

    //二手房留言
    public function usedDetail(){
        $id = intval($_GET['id']);
        $order = M('order_used')->where(array('id'=>$id,'user_id'=>$this->user['id']))->find();
        if(!$order['id']){
            $this->error('找不到对应的二手房信息');
        }
        $this->used = M('used')->where(array('id'=>$order['used_id']))->field('title')->find();
        $this->order = $order;
        $this->seoKey(array('seo_title'=>'二手房详细'));
        $this->display();
    }


    //出租房留言
    public function rental(){
        $member = new Member();
        $list = $member::getRentalMess(20,array('orr.user_id'=>$this->user['id']),true);
        $this->type = order_type('rental');
        $this->list = $list;
        $this->seoKey(array('seo_title'=>'出租房'));
        $this->display();
    }

    //出租房留言
    public function rentalDetail(){
        $id = intval($_GET['id']);
        $order = M('order_rental')->where(array('id'=>$id,'used_id'=>$this->user['id']))->find();
        if(!$order['id']){
            $this->error('找不到对应的出租房信息');
        }
        $this->rental = M('rental')->where(array('id'=>$order['rental_id']))->field('title')->find();
        $this->order = $order;
        $this->seoKey(array('seo_title'=>'出租房详细'));
        $this->display();
    }



}